package com.yuyou.tas.job.service;

import java.util.Calendar;
import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.yuyou.tas.service.api.lesson.service.StudentAPI;
import com.yuyou.tas.util.tool.DateUtil;

@Component
public class SycnClassStudentScheduled {

	@Autowired
	private StudentAPI studentAPI;

	private final Logger logger = LoggerFactory.getLogger(this.getClass());  
	
	@Scheduled(cron="0 0/5 * * * ?")
    public void executeUpdateClassStatusTask5Min() {	
				
		//前5分钟
		Calendar beforeTime = Calendar.getInstance();
		beforeTime.add(Calendar.MINUTE, -10);
		Date beforeD = beforeTime.getTime();
		String startTime=DateUtil.format(beforeD, DateUtil.yyyyMMddHHmmss);	
		studentAPI.sycnClassStudentData(startTime);  	
    }
	
//	@Scheduled(cron="0 0/60 * * * ?")
//    public void executeUpdateClassStatusTask60MIn() {	
//		studentAPI.sycnClassStudentData(null);  	
//    }
	
}
